home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Dev / basic / blitzgtfix.lha / BlitzGTFix / BBGTLib_Examples / gtchangelist.bb2 < prev    next >
Text File  |  2002-01-30  |  1KB  |  53 lines

  1. WbToScreen 3
  2. Use Screen 3
  3.  
  4. LoadFont 2,"topaz.font",8
  5. Use IntuiFont 2
  6.  
  7. NEWTYPE.gtlv_item
  8.     pad.w
  9.     text$
  10. End NEWTYPE
  11.  
  12. Dim List dummy.gtlv_item(10)
  13.  
  14. foo.l=GTListView(0,1,20,20,200,150,"Items",#PLACETEXT_ABOVE,dummy())
  15. NPrint Hex$(foo)
  16.  
  17. GTButton 0,2,20,170,200,15,"Add item",#PLACETEXT_IN
  18.  
  19. AddIDCMP #LISTVIEWIDCMP|BUTTONIDCMP
  20.  
  21. Window 0,0,0,600,300,$100f,"jjlk",-1,-1
  22. DefaultOutput
  23. CatchDosErrs
  24.  
  25. AttachGTList 0,0
  26. While ev.l<>#IDCMP_CLOSEWINDOW
  27.     ev.l=WaitEvent
  28.     Select ev
  29.         Case #IDCMP_GADGETUP
  30.             If GadgetHit=2
  31.                 ; Before changing the actual contents of the list being displayed in
  32.                 ; a listview gadget, you must detach it from the listview gadget.
  33.                 ; This is done like this:
  34.                 GTChangeList 0,1
  35.  
  36.                 ; Now we are free to change the list
  37.                 If AddLast(dummy())
  38.                     dummy()\text = String$(Chr$(Rnd(26)+65),5+Rnd(5))
  39.                 Else
  40.                     foo.l=RTEZRequest("GTChangeList example","Cannot add any more items to list - it's full!","OK")
  41.                 EndIf
  42.  
  43.                 ; Finally, we can attach the list back onto the listview gadget
  44.                 GTChangeList 0,1,dummy()
  45.             EndIf
  46.     End Select
  47. Wend
  48. DetachGTList 0
  49. End
  50.  
  51.  
  52.  
  53.